#ifndef __U2GLESContext_H__
#define __U2GLESContext_H__


#include "U2GLESPreRequest.h"


U2EG_NAMESPACE_BEGIN


/** Class that encapsulates an GL context. (IE a window/pbuffer). This is a 
    virtual base class which should be implemented in a GLSupport.
    This object can also be used to cache renderstate if we decide to do so
    in the future.
 */
class _U2GLESShare U2GLESContext
{
public:
    U2GLESContext();
    virtual ~U2GLESContext();

    /** Enable the context. All subsequent rendering commands will go here.
    */
    virtual void setCurrent() = 0;

    /** This is called before another context is made current. By default,
        nothing is done here.
    */
    virtual void endCurrent() = 0;

    bool getInitialized() { return initialized; };
    void setInitialized() { initialized = true; };

    /** Create a new context based on the same window/pbuffer as this
        context - mostly useful for additional threads.
    @note The caller is responsible for deleting the returned context.
    */
    virtual U2GLESContext* clone() const = 0;

protected:
    bool initialized;

};


U2EG_NAMESPACE_END


#endif
